#!/usr/bin/env python    
# -*- coding: utf-8 -*-    
import httplib2
import urllib
url="http://127.0.0.1/phpDemo/"
url2="http://106.120.106.9:8095/seckill/specialfirst"
h=httplib2.Http(".cache")
data=urllib.urlencode({'name':'wong','age':'26'})
status="GET"
headers={
         'Content-type':'application/x-www-form-urlencoded',
         'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36',
         'Accept':'text/plain'
}

if status=="GET":
    fullUrl=url+"test2.php?"+data
    res,content=h.request(fullUrl,"GET",None,headers)
    print content.decode("utf8")

elif status=="POST":
    fullUrl=url+"test.php"
    res,content=h.request(fullUrl,"POST",data,headers)
    print content

else:
    fullUrl=url2+"?"+urllib.urlencode({'clientversion':"6.4.0"})
    res,content=h.request(fullUrl,"GET",None,headers)
    print content